<?php 
	$category_html = array(1	=> "",2	=> "");
?>
<?php foreach ($this->paginator as $key => $value){
	$category_html[$value["type"]] .= "<div class='col-md-9'><input name ='category_" . $value['id'] . "' class = 'form-control' type = 'text' value = '" . $value['name'] . "'></div><div class = 'col-md-3'><a href = '/admin/category/delete/id/" . $value["id"]. "' class='btn btn-default'>Xóa</a></div><br/><br/>";
	$max_category = $value['id'];
}
?>
<div class="col-md-6">
	QUẢN LÝ CHUYÊN MỤC CON
</div>
<br />
<br />
<div class="col-md-12">
	<form method="post" action="" id = "add_category">
	<?php echo $this->formHidden("number_app",0)?>
	<?php echo $this->formHidden("number_game",0)?>
	<?php echo $this->formHidden("max_category",$max_category)?>
		<div class="col-md-12">
			<input type="submit" value="SAVE" style="padding: 10px 25px;
										background: #359AFF;
										display: inline-block;
										margin-top: 10px;
										margin-bottom: 10px;
										color: #fff;
										text-transform: uppercase;
										font-size: 16px;
										text-decoration: none;">
		</div>
		<br />
		<br />
		<div class="col-md-6">
			<div class="col-md-12">CHUYÊN MỤC GAME</div>
			<?php echo $category_html[1]?>
			<div class="col-md-12">
				<a id = "add_game" style="background: #359AFF;
						padding: 15px 25px;
						display: inline-block;
						margin-top: 10px;
						color: #fff;
						text-transform: uppercase;
						font-size: 16px;
						text-decoration: none;
				">
					Thêm chuyên mục
				</a>
			</div>
		</div>
		<div class="col-md-6">
			<div class="col-md-12">CHUYÊN MỤC ỨNG DỤNG</div>
			<?php echo $category_html[2]?>
			<div class="col-md-12">
				<a id = "add_app" style="background: #359AFF;
						padding: 15px 25px;
						display: inline-block;
						margin-top: 10px;
						color: #fff;
						text-transform: uppercase;
						font-size: 16px;
						text-decoration: none;
				">
					Thêm chuyên mục
				</a>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
<!--
$(document).ready(function(){
	var number_app = 0;
	var number_game = 0;
	$("#add_app").click(function(e){
		
		$("#add_app").parent().before("<div class='col-md-9'><input name = 'add_app_" + number_app + "' class = 'form-control' type = 'text' value = ''></div><br/><br/>");
		number_app++;
	});
	$("#add_game").click(function(e){
		
		$("#add_game").parent().before("<div class='col-md-9'><input name = 'add_game_" + number_app + "' class = 'form-control' type = 'text' value = ''></div><br/><br/>");
		number_game++;
	});
	$( "#add_category" ).submit(function( event ) {
		$("#number_app").val(number_app);
		$("#number_game").val(number_game);
	});
});
//-->
</script>